package com.sinosoft.cloud.annotation;

import com.alibaba.fastjson.JSONObject;
import com.sinosoft.cloud.rest.TradeInfo;

/**
 * 描述:
 * 组装请求报文所使用的父类
 * @author 张旭东
 * @date 2018/11/27
 */
public abstract class ReqJsonBean {
    public String request(TradeInfo tradeInfo){
        JSONObject res = new JSONObject();
        JSONObject header = header(tradeInfo);
        JSONObject body = body(tradeInfo);
        JSONObject request = new JSONObject();
        request.put("header",header);
        request.put("body",body);
        res.put("request",request);
        return request.toJSONString();
    }
    public abstract JSONObject header(TradeInfo tradeInfo);
    public abstract JSONObject body(TradeInfo tradeInfo);
}
